import foliumimport pandas as pdimport geopandas as gpdimport matplotlib.pyplot as pltfrom matplotlib.colors import rgb2heximport numpy as npdataset_gpd = gpd.read_file("https://gitlab.com/drvicsana/opt-milp-project-2025/-/raw/main/datasets/dataset.geojson")
Available Data
The dataset contains the following attributes for each cell in the discretized map of Menorca:
Attribute
Description
Domain
grid_id
Identifier of a cell in Menorca’s map (column and row number)
String
dominant_land_cover_name
Dominant type of land in the cell
String
cost_adaptation_atelerix
Cost of making some adaptations in the cell for the atelerix
Float
cost_adaptation_martes
Cost of making some adaptations in the cell for the martes martes
Float
cost_adaptation_eliomys
Cost of making some adaptations in the cell for the eliomys quercinus
Float
cost_adaptation_oryctolagus
Cost of making some adaptations in the cell for the oryctolagus cuniculus
Float
cost_corridor
Cost of preparing a single corridor in the cell
Float
has_atelerix_algirus
Whether or not the cell has a living colony of atelerix
Boolean
has_martes_martes
Whether or not the cell has a living colony of martes martes
Boolean
has_eliomys_quercinus
Whether or not the cell has a living colony of eliomys quercinus
Boolean
has_oryctolagus_cuniculus
Whether or not the cell has a living colony of european rabbit
Boolean
geometry
The polygon that describes the cell
Geometry
Corridor Cost Analysis
We observe that the distribution of corridor costs is normally distributed.
plt.figure(figsize=(10, 6))plt.hist(dataset_gpd["cost_corridor"], bins=25, edgecolor="black")plt.xlabel("Cost of Corridor")plt.ylabel("Frequency")plt.title("Distribution of Cost of corridor")plt.show()
Adaptation Analysis
Here is analysed the adaptation for the four species considered in the project: Oryctolagus cuniculus, Eliomys quercinus, Martes martes and Atelerix algirus.
Sustainability Scores
Firstly, is important to assign a suitability score to each land cover type for each species. These scores are based on ecological studies and expert opinions regarding the habitat preferences of each species.
Observing the suitability assignment, there are some cells that have a land cover type that is not considered in the suitability mapping, resulting in NaN values for their suitability scores. These cells need to be handled appropriately before proceeding with further analysis. In this case, these cells will be dropped from the dataset to ensure that all remaining cells have valid suitability scores for all species.
For the sustainability visualization, it is convenient to convert the categorical suitability scores into numerical values for easier mapping and visualization. The following mapping is used:
Make this Notebook Trusted to load map: File -> Trust Notebook
Suitability Maps for O. cuniculus
Code
map_algirus
Make this Notebook Trusted to load map: File -> Trust Notebook
Suitability Maps for A. algirus
Code
map_quercinus
Make this Notebook Trusted to load map: File -> Trust Notebook
Suitability Maps for E. quercinus
Code
map_martes
Make this Notebook Trusted to load map: File -> Trust Notebook
Suitability Maps for M. martes
Visually inspecting the maps, it can be noted a certain relation between the species with respect to the suitability scores. The Oryctolagus cuniculus and Atelerix algirus seem to have a similar distribution of suitability scores across the island, with many areas showing high suitability for both species. On the other hand, the Eliomys quercinus and Martes martes also exhibit a similar pattern to each other, but their suitability distributions differ from the first two species. This suggests that the habitat preferences of these species may overlap to some extent, but there are also distinct differences in their ecological requirements. An hypothesis could be that the Martes martes would have the same habitat preferences as the Eliomys quercinus due to their predator-prey relationship.
Benefit Estimation
In order to estimate the benefit, is important to analyse the adaptation costs, while it is necessary to make a value in the same scale. So the first step is to observe the distribution of adaptation costs.
Observing the distibution plots, it seems that, for all the species, the costs follow a mixture of two distributions: a large number of low values and a small number of very high values. This suggests that most cells have relatively low adaptation costs, while a few cells are significantly more expensive to adapt. This pattern could reflect the varying suitability of different land types for each species, with some areas requiring minimal modifications and others needing substantial changes to become viable habitats.
It is also important to note that, the oryctolagus cuniculus, presents really high adaptation costs in comparison to the other species in some parcels.
For these reasons, the benefit, will be calculated as the suitability score multiplied by a cost multiplier based on the 75th percentile of adaptation costs, a value of 6.82. The goal is to get a good trade-off between suitability and cost, prioritizing areas that offer high suitability at a reasonable adaptation cost.
Here is the table that shows the mapping from suitability scores to benefit multipliers: